<script lang="ts" setup>
import { ref } from "vue";
const orderType = ref("takein");
const takout = ()=>{}
</script>

<template>
          <view class="nav">
        <view class="header">
          <view class="left" v-if="orderType == 'takein'">
            <view class="store-name">
              <text>深圳市教育路大学店</text>
              <view class="iconfont iconarrow-right"></view>
            </view>
            <view class="store-location">
              <up-icon name="map"></up-icon>
              <text>距离您 1.0km</text>
            </view>
          </view>
          <view class="left overflow-hidden" v-else>
            <view class="d-flex align-items-center overflow-hidden">
              <image
                src="/static/images/order/location.png"
                style="width: 30rpx; height: 30rpx"
                class="mr-10"
              ></image>
              <view
                class="font-size-extra-lg text-color-base font-weight-bold text-truncate"
              >
                {{ "东门老街店铺" }}
              </view>
            </view>
            <view
              class="font-size-sm text-color-assist overflow-hidden text-truncate"
            >
              由<text class="text-color-base" style="margin: 0 10rpx">{{
                "观澜店"
              }}</text
              >配送
            </view>
          </view>
          <view class="right">
            <view
              class="dinein"
              :class="{ active: orderType == 'takein' }"
              @tap="SET_ORDER_TYPE('takein')"
            >
              <text>自取</text>
            </view>
            <view
              class="takeout"
              :class="{ active: orderType == 'takeout' }"
              @tap="takout"
            >
              <text>外卖</text>
            </view>
          </view>
        </view>
        <view class="coupon">
          <text class="title">"霸气mini卡"超级购券活动，赶紧去购买</text>
          <up-icon name="arrow-right" color="#f0ad4e"></up-icon>
        </view>
      </view>
</template>

<style lang="scss" scoped>
.nav {
  width: 100%;
  height: 212rpx;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;

  .header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20rpx;
    background-color: #ffffff;
    height: 140rpx;

    .left {
      flex: 1;
      display: flex;
      flex-direction: column;

      .store-name {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        font-size: $uni-font-size-lg;
        margin-bottom: 10rpx;

        .iconfont {
          margin-left: 10rpx;
          line-height: 100%;
        }
      }

      .store-location {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        color: $uni-text-color;
        font-size: $uni-font-size-sm;

        .iconfont {
          vertical-align: middle;
          display: table-cell;
          color: $uni-color-primary;
          line-height: 100%;
        }
      }
    }

    .right {
      background-color: $uni-bg-color-grey;
      border-radius: 38rpx;
      display: flex;
      align-items: center;
      font-size: $uni-font-size-sm;
      padding: 0 38rpx;
      color: $uni-text-color;

      .dinein,
      .takeout {
        position: relative;
        display: flex;
        align-items: center;

        &.active {
          padding: 14rpx 38rpx;
          color: #ffffff;
          background-color: $uni-color-warning;
          border-radius: 38rpx;
        }
      }

      .takeout {
        margin-left: 20rpx;
        height: 100%;
        flex: 1;
        padding: 14rpx 0;
      }

      .dinein.active {
        margin-left: -38rpx;
      }

      .takeout.active {
        margin-right: -38rpx;
      }
    }
  }

  .coupon {
    flex: 1;
    width: 100%;
    background-color: #f9e8d2;
    //font-size: $uni-font-size-base;
    color: $uni-color-warning;
    padding: 0 20rpx;
    display: flex;
    align-items: center;
    overflow: hidden;

    .title {
      flex: 1;
      margin-left: 10rpx;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .iconfont {
      line-height: 100%;
    }
  }
}

</style>